﻿
<template>
    <el-row :gutter="20" style="height:60px;padding:20px;" type="flex">
        <el-col :span="5">
            <div class="input-group" style="margin-bottom:10PX;">
                <div class="input-group-btn">
                    <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">管理站</button>
                </div>
                <el-select placeholder="选择管理站" size="mini" v-model="tkjc" class="form-control filter" style="height: 34px;padding:0px;" @change="sellb" clearable filterable>
                    <el-option-group v-for="zz in bms"
                                     :key="zz.DeptCode"
                                     :label="zz.DeptName">
                        <el-option v-for="item in zz.ChildBranch"
                                   :key="item.DeptCode"
                                   :label="item.DeptName"
                                   :value="item.DeptCode">
                        </el-option>
                    </el-option-group>
                </el-select>
            </div>
        </el-col>
        <el-col :span="20">
            
        </el-col>
    </el-row>
</template>


<script>
    //输出得查询格式必须为{ colid: obj.cxzd, cal: obj.cal, val: va.itemtext }，colid为字段,cal为查询类型(0:等于,1:包含-逗号隔开).val为值
    module.exports = {
        props: ['pzoption'],
        data() {
            return {
                isshow: false,
                tkjc:"",
                bms: [],
            };
        },
        computed: {

        },
        methods: {
            sellb: function (val) {
                if (val) {
                    this.pzoption.value = [{ colid: "zid", cal: "0", val: val }];
                } else {
                    this.pzoption.value = [];
                }
                this.$parent.Query();
            },
        },
        mounted: function () {
            var chi = this;
            chi.$nextTick(function () {
                $.getJSON('/api/Auth/ExeAction?Action=GETALLBMNEW', {}, function (resultData) {
                    chi.bms = resultData.Result[0].ChildBranch;
                    if (chi.bms[0].ChildBranch[0].DeptCode) {
                        try {
                            chi.tkjc = chi.bms[0].ChildBranch[0].DeptCode;
                            chi.pzoption.value = [{ colid: "zid", cal: "0", val: chi.tkjc }];

                        } catch (e) {
                        }
                    }
                    chi.$parent.Query();
                })
            })

        }
    };
</script>